<div class="container-fluid">
 
    <div class="row">
      <div class="col-md-4"></div>
      <div class="col-md-4 col-sm-12">    
        <div class="card mt-4 border-0" >
          <img src="/static/img/login-pic.jpg" class="card-img-top d-block d-lg-none" alt="">
          <div class="card-body">
            <form>
                <div class="form-group">
                    <p class="h5 text-center">修改密码</p>
                    <input type="hidden" id="f" name="f" value="{{.TO_URL}}" />
                </div>
                <div class="form-group">
                  <label for="user_password">原密码</label>
                  <input type="password" class="form-control" id="user_password" placeholder="原密码">
                </div>
                <div class="form-group">
                    <label for="user_password">新密码</label>
                    <input type="password" class="form-control" id="new_password1" placeholder="新密码">
                </div>
                <div class="form-group">
                  <label for="user_password">新密码</label>
                  <input type="password" class="form-control" id="new_password2" placeholder="再次输入新密码">
                </div>
                <div class="form-group text-center">
                    <button type="button" id="loginButton" class="btn btn-primary btn-sm">修改密码</button>
                </div>
              </form>
        </div>
     </div>
    </div>
      <div class="col-md-4"></div>
    </div>
    </div>
  
    <script>
      $(function(){
          $("#captcha_img").on("click", function(){
              var path = '{{.CaptchaPath}}';
              path += '?t=' + new Date().getTime()
              $("#captcha_img").attr("src", path);
          });
          $("#loginButton").on("click", function(){
             
              var userpass = $("#user_password").val();
              var new_password1 = $("#new_password1").val();
              var new_password2 = $("#new_password2").val();
              
              if(userpass.length == 0){
                  pubmain.toast('请输入原密码');
                  return;
              }
              if(new_password1.length == 0){
                  pubmain.toast('请输入新密码');
                  return;
              }
              if(new_password1 != new_password2){
                  pubmain.toast('两次密码不一致');
                  return;
              }

              $.post("/user/reset_pass", {
                userpass: userpass, 
                userpass_new: new_password1, 
              }, function(json){
                pubmain.toast(json.msg);
              });
          });
      });
    </script>